﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Areas/Manage/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<QianBuo.Lottery.Web.Areas.Manage.Models.SchemeModels.DetailModel>" %>
<%@ Import Namespace="Code.Models" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	方案详情
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div>
        <%if (Request["ReturnUrl"] != null)%>
        <%{%>
        <a class="a_blue" href='<%=Request["ReturnUrl"] %>'>&gt;&gt;返回</a>
        <%} %>
        <table class="table" width="100%">
            <%if (ViewData.ModelState.IsValid)%>
            <%{%>
            <% var state=(SchemeState)Model.Scheme.State; %>
            <tr class="th">
                <th colspan="11" align="left">方案详情</th>
            </tr>
            <tr>
                <td align="right">发&nbsp;起&nbsp;人:</td>
                <td align="left"><%=Model.Scheme.UserName%></td>
                <td align="right">发起时间:</td>
                <td align="left" colspan="3"><%=Model.Scheme.AddTime.ToString("yyyy-MM-dd HH:mm:ss")%></td>
                <td align="right">彩&nbsp;&nbsp;&nbsp;&nbsp;种:</td>
                <td align="left"><%=Model.Scheme.LotteryName%></td>
                <td align="right">期&nbsp;&nbsp;&nbsp;&nbsp;号:</td>
                <td align="left"><%=Model.Scheme.IssueName%></td>
            </tr>
            <tr>
                <td align="right">总&nbsp;注&nbsp;数:</td>
                <td align="left"><%=Model.Scheme.SchemeCount%></td>
                <td align="right">购买倍数:</td>
                <td align="left" colspan="3"><%=Model.Scheme.Multiple%></td>
                <td align="right">方案金额:</td>
                <td align="left"><%=Model.Scheme.SchemeMoney.ToString("F")%></td>
                <td align="right">追号任务:</td>
                <td align="left"><%=Model.Scheme.IsChaseTask ? "是" : "否"%></td>
            </tr>
            <tr>
                <td align="right">元角模式:</td>
                <td align="left"><%=Model.Scheme.RatioName%></td>
                <td align="right">奖金模式:</td>
                <td align="left"><%=Model.Scheme.WinModelName%></td>
                <td align="right">方案状态:</td>
                <td align="left"><%=Model.Scheme.StateName%></td>
                <td align="right">开奖号码:</td>
                <td align="left"><%=Model.Scheme.OpenCode%></td>
                <td align="right">方案奖金:</td>
                <td align="left"><%=string.Format("{0:F}", Model.Scheme.WinMoney)%></td>
            </tr>
            <tr>
                <td align="right">操作</td>
                <td colspan="10" align="left">
                    <%=state == SchemeState.Normal || state == SchemeState.OutBill ? Html.ActionLink("系统撤单", "Cancle", new { ID = Model.Scheme.SchemeID, Type = SchemeState.SysCancel,act=Request["act"],cont=Request["cont"], returnurl = Url.Action("Detail", new { ID = Model.Scheme.SchemeID, returnurl = Request["returnurl"] }) }, new { @class = "a_blue", onclick = "return confirm('资金将返还给用户，此操作将不可回滚。\\r\\n确定要撤销此方案吗？')" }) : MvcHtmlString.Empty%>
                    <%=state == SchemeState.Normal || state == SchemeState.OutBill ? Html.ActionLink("过期撤单", "Cancle", new { ID = Model.Scheme.SchemeID, Type = SchemeState.TimeOutCancel, returnurl = Url.Action("Detail", new { ID = Model.Scheme.SchemeID, act = Request["act"], cont = Request["cont"], returnurl = Request["returnurl"] }) }, new { @class = "a_blue", onclick = "return confirm('资金将返还给用户，此操作在该期开奖时可回滚。\\r\\n确定要撤销此方案吗？')" }) : MvcHtmlString.Empty%>
                    <%=!string.IsNullOrEmpty(Model.Scheme.OpenCode) && (state == SchemeState.Normal || state == SchemeState.OutBill || state == SchemeState.TimeOutCancel) ? Html.ActionLink("派奖", "PaiJiang", new { ID = Model.Scheme.SchemeID, act = Request["act"], cont = Request["cont"], returnurl = Url.Action("Detail", new { ID = Model.Scheme.SchemeID, returnurl = Request["returnurl"] }) }, new { @class = "a_blue", onclick = "return confirm('确定要为此方案派奖吗？')" }) : MvcHtmlString.Empty%>
                    <%=state == SchemeState.Normal ? Html.ActionLink("出票", "ChuPiao", new { ID = Model.Scheme.SchemeID, returnurl = Url.Action("Detail", new { ID = Model.Scheme.SchemeID, act = Request["act"], cont = Request["cont"], returnurl = Request["returnurl"] }) }, new { @class = "a_blue", onclick = "return confirm('确定要为此方案出票吗')" }) : MvcHtmlString.Empty%>
                </td>
            </tr>
        </table>
        <% if (state == SchemeState.Opened)%>
        <%{%>
        <p />
        <table class="table" width="100%">
            <tr class="th"><th colspan="2" align="left">奖金、返奖明细</th></tr>
            <%foreach (var item in Model.WinMoneys)%>
            <%{%>
            <tr>
                <td width="50%"><%=item.UserName + (item.UserName == Model.Scheme.UserName ? "&nbsp;(购彩用户)" : "") %></td>
                <td><%=string.Format("{0:F}", item.Money)%></td>
            </tr>
            <%} %>
        </table>
        <%} %>
        <p />
        <table class="table" width="100%">
            <tr class="th">
                <th>玩法</th><th>号码</th><th>注数</th><th>返点加奖</th><th>金额</th><th>中奖号码</th><th>中奖金额</th>
            </tr>
            <%foreach (var item in Model.Plays)%>
            <%{%>
            <tr>
                <td><%=item.PlayTypeName%></td>
                <td><div class="numberitem"><%=item.Number%></div></td>
                <td><%=item.Count%></td>
                <td><%=item.BackMoneyToWinMoney.HasValue ? item.BackMoneyToWinMoney + "%" : "--" %></td>
                <td><%=item.Money.ToString("F2")%></td>
                <td><%=item.WinNumber%></td>
                <td title="<%=item.BackMoneyToWinMoneyToWin.HasValue ? string.Format("原始奖金:{0:F2} 返点加奖:{1:F2}", item.OriginalWinMoney, item.BackMoneyToWinMoneyToWin) : string.Empty %>"><%=string.Format("{0:F2}", item.WinMoney)%></td>
            </tr>
            <%} %>
        </table>
        <p></p>
        <% if (Model.ChaseTaskDetailList != null && Model.ChaseTaskDetailList.Count() > 0)
           { %>
        <table class="table" width="100%">
            <tr class="th">
                <th>期号</th><th>金额</th><th>倍数</th><th>状态</th><th>开奖号码</th>
            </tr>
            <%var j = 0; foreach (var item in Model.ChaseTaskDetailList)%>
            <% { %>
            <tr <%=j++%2==1?"class='supersede'":"" %> id='tr_<%=j %>'>
                <td><%=item.IssueName%></td>
                <td><%=item.Money.ToString("F2")%></td>
                <td><%=item.Multiply%></td>
                <td class='td_<%=j %>'><%=item.State==(short)ChaseTaskState.Normal?"正在进行":((ChaseTaskState)item.State).GetName()%></td>
                <td><%=item.OpenCode %></td>
            </tr>
            <%} %>
        </table>
            <p></p>
        <%} %>
        <%}%>
        <%else%>
        <%{%>
        <table class="table" width="100%">
            <tr><td><%=Html.ValidationSummary()%></td></tr>
        </table>
        <%} %>
    </div>
</asp:Content>

